<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"> 
        <input @click = "toggleIf" type="button" value="切换if" >
        <div v-if = "v_if">true添加，false删除，性能消耗大</div>
        <div v-show = "v_if">true显示，false隐藏，性能消耗小</div>

        <div v-if = "temperature>38">温度超过38度</div>


    </div>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                v_if: true,
                temperature:40
            },
            methods:{
            toggleIf(){
                this.v_if = !this.v_if;    

            }

            }
        })
    </script>
</body>
</html>